<?php

namespace app\user\controller;

use app\common\respond\HttpApi;
use app\user\logic\PigHealthEatLogic;

class PigHealthController
{
    /**
     * @Description 统计
     * @author: zj
     * @param HttpApi $respond
     * @time 2024/03/28 10:26:31
     * @return \think\response\Json
     */
    public function statistic(HttpApi $respond)
    {
        $param = [
            'pig_id' => request()->get('pig_id'),
            'record_time_start' => request()->get('record_time_start'),
            'record_time_end' => request()->get('record_time_end'),
        ];
        $rule = [
            'pig_id' => 'require|integer|>:0',
            'record_time_start' => 'require|dateFormat:Y-m-d H:i:s',
            'record_time_end' => 'require|dateFormat:Y-m-d H:i:s',
        ];
        validate($rule)->check($param);

        $logic = new PigHealthEatLogic();
        $data = $logic->statistic($param);

        return $respond->success($data);
    }

}